using System;
using System.Collections.Generic;
using System.Text;
using ContactsTester;

namespace Sync.Events
{
    /// <summary>
    /// Default event handlers for events hard-wired 
    /// </summary>
    public static class EventHandlers
    {
        /// <summary>
        /// Method Fired When a Contact already exists
        /// </summary>
        /// <param name="args"></param>
        public static void SyncManager_OnContactExists(ContactEventArgs args)
        {
        
        }

        /// <summary>
        /// Fires when contacts a about to be synced
        /// </summary>
        /// <param name="args"></param>
        public static void SyncManager_OnSyncContacts(EventArgs args)
        {
        
        }

        /// <summary>
        /// Fires before a contact is created
        /// </summary>
        /// <param name="args"></param>
        public static void SyncContact_OnBeforeContactCreate(ContactEventArgs args)
        {
            
        }

        /// <summary>
        /// Fires after a contact is created.
        /// </summary>
        /// <param name="args"></param>
        public static void SyncContact_OnAfterContactCreate(ContactEventArgs args)
        {

        }

        /// <summary>
        /// Fires after a contact has been updated.
        /// </summary>
        /// <param name="args"></param>
        public static void SyncContact_OnAfterContactUpdate(ContactEventArgs args)
        {
        }

        /// <summary>
        /// Fires before a contact is updated.
        /// </summary>
        /// <param name="args"></param>
        public static void SyncContact_OnBeforeContactUpdate(ContactEventArgs args)
        {
        }

        /// <summary>
        /// Fires when a contact is found during a search
        /// </summary>
        /// <param name="args"></param>
        public static void SyncContact_OnFindContact(ContactEventArgs args)
        {
        }

        /// <summary>
        /// Fires when the google connector creates its initial connection
        /// </summary>
        /// <param name="args"></param>
        public static void GoogleContactConntector_OnConnectContacts(ConnectEventArgs args)
        {

        }

        /// <summary>
        /// Fires when a outlook connector makes its initial connection
        /// </summary>
        /// <param name="args"></param>
        public static void OutlookConnector_OnConnectContacts(ConnectEventArgs args)
        {
        }

        /// <summary>
        /// Fires when a contact is saved.
        /// </summary>
        /// <param name="args"></param>
        public static void SyncManager_OnSaveContacts(SaveEventArgs args)
        {

        }
    }

    public class SaveEventArgs : EventArgs
    {
        private SaveType type;

        public SaveType Type
        {
            get { return type; }
            set { type = value; }
        }
        public SaveEventArgs(SaveType type)
        {
            this.Type = type;
        }
        private string location;
        /// <summary>
        /// Gets or sets the location that is being saved to.
        /// </summary>
        public string Location
        {
            get { return location; }
            set { location = value; }
        }

    }
    /// <summary>
    /// Event args for typical contact actions
    /// </summary>
    public class ContactEventArgs : EventArgs
    {
        public ContactEventArgs(SyncContact contact,UpdateType type)
        {
            this.Contact = contact;
            this.Type = type;
        }
        private SyncContact contact;
	    public SyncContact Contact
	    {
		    get { return contact;}
		    set { contact = value;}
	    }
        private UpdateType type;

        public UpdateType Type
        {
            get { return type; }
            set { type = value; }
        }
        private bool specific;
        /// <summary>
        /// Gets or set whether the event type is detail specific.
        /// </summary>
        public bool Specific
        {
            get { return specific; }
            set { specific = value; }
        }
        private bool exists;
        /// <summary>
        /// Gets or sets whether the contact exists.
        /// </summary>
        public bool Exists
        {
            get { return exists; }
            set { exists = value; }
        }


    }
    /// <summary>
    /// Event args for Connections
    /// </summary>
    public class ConnectEventArgs : EventArgs
    {
        public ConnectEventArgs(UpdateType connectionType)
        {
            this.ConnectionType = connectionType;
        }
        private UpdateType connectionType;

        public UpdateType ConnectionType
        {
            get { return connectionType; }
            set { connectionType = value; }
        }
        private bool sucessful;
        /// <summary>
        /// Gets or set whether the connection was successful
        /// </summary>
        public bool Successful
        {
            get { return sucessful; }
            set { sucessful = value; }
        }
        private bool exists;
        /// <summary>
        /// Gets or sets whether a contact exists.
        /// </summary>
        public bool Exists
        {
            get { return exists; }
            set { exists = value; }
        }
    }
    public class SyncEvents
    {
        #region Contact
        

        /// <summary>
        /// Fires when a contact is being found.
        /// </summary>
        public delegate void FindContact(ContactEventArgs args);
       
        
        /// <summary>
        /// Fires after the contact is updated
        /// </summary>
        public delegate void AfterContactUpdate(ContactEventArgs args);

       

        /// <summary>
        /// Fires before the contact updates
        /// </summary>
        public delegate void BeforeContactUpdate(ContactEventArgs args);
        /// <summary>
        /// Fires before the contact is Created
        /// </summary>
        public delegate void BeforeContactCreate(ContactEventArgs args);


        /// <summary>
        /// Fires after the contact is Created
        /// </summary>
        public delegate void AfterContactCreate(ContactEventArgs args);


        /// <summary>
        /// Fires when a contact is being checked for existence.
        /// </summary>
        public delegate void ContactExists(ContactEventArgs args);
        
        
        #endregion
        #region Contacts
        /// <summary>
        /// Fires when contacts are being syncronised
        /// </summary>
        public delegate void SyncContacts(EventArgs args);


        /// <summary>
        /// Fires when a connection to a contacts providor is attpemted
        /// </summary>
        public delegate void ConnectContacts(ConnectEventArgs args);
        
       
        /// <summary>
        /// Occurs when contacts are being saved 
        /// </summary>
        public delegate void SaveContacts(SaveEventArgs args);
        
        
        #endregion
    }
}
